package com.sixth.service.Impl;

import com.alibaba.druid.sql.dialect.h2.visitor.H2ASTVisitor;
import com.sixth.dao.TypeDao;
import com.sixth.entity.*;
import com.sixth.dao.TypeDao;
import com.sixth.entity.Staff;
import com.sixth.service.TypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.servlet.http.HttpSession;
import java.util.List;
import java.util.Map;

/**
 * @program: project01
 * @description:
 * @author: 老魏
 * @create: 2021-12-17 21:33
 **/
@Service(value = "typeService")
public class TypeServiceImpl implements TypeService {
   @Autowired
    private TypeDao typeDao;
   @Autowired
   private HttpSession session;

    public TypeServiceImpl() {
    }

    public List<Map> getAllType() {
        Staff staff = (Staff)session.getAttribute("staff");
        Integer branchid = staff.getBranchid();
        List<Map> allType = null;
        if (branchid == 12138) {
            allType =typeDao.getAllType();
        } else {
            allType =typeDao.getAllBranchById(branchid);
        }

        return allType;
    }

    public List<Map> getAllType1() {
        Staff staff = (Staff)session.getAttribute("staff");
        Integer branchid = staff.getBranchid();
        List<Map> allType = typeDao.getAllType();
        return allType;
    }

    public List<Map> getAllType2() {
        List<Map> allType = typeDao.getAllType2();
        return allType;
    }

    public List<Map> getAllType3() {
        Staff staff = (Staff)session.getAttribute("staff");
        Integer branchid = staff.getBranchid();
        List<Map> allType = typeDao.getAllType3(branchid);
        return allType;
    }

    public List<Map> getAllType4() {
        Staff staff = (Staff)this.session.getAttribute("staff");
        Integer branchid = staff.getBranchid();
        List<Map> allType = this.typeDao.getAllType4();
        return allType;
    }

    public List<Map> getDept() {
        List<Map> dept = this.typeDao.getDept();
        return dept;
    }

    public List<Map> getDept1() {
        List<Map> dept = this.typeDao.getDept1();
        return dept;
    }

    public List<Keycap> getAllKeyCap() {
        return this.typeDao.getAllKeyCap();
    }

    public List<Keyboardcolor> getAllKeyBoardColor() {
        return this.typeDao.getAllKeyBoardColor();
    }

    public List<Shaftchoose> getAllShaftChoose() {
        return this.typeDao.getAllShaftChoose();
    }

    public List<Backlightcolor> getAllBacklightColor() {
        return this.typeDao.getAllBacklightColor();
    }

    public List<Goods> getAllCommodity() {
        List<Goods> allCommodity = this.typeDao.getAllCommodity();
        return allCommodity;
    }

    public List<Branch> getAllShop(Branch branch) {
        List<Branch> allShop = this.typeDao.getAllShop(branch);
        return allShop;
    }

    public List<Map> getAllRole() {
        return this.typeDao.getAllRole();
    }
}


